import React, { useEffect, useRef, useState } from 'react';
import { Button } from 'antd';
import { useHistory } from 'react-router-dom';
import { BlobProvider, PDFDownloadLink, PDFViewer } from '@react-pdf/renderer';
import { Document, Page, pdfjs } from 'react-pdf';
import TablePdf from './ReactPdfRenderer/TablePdf';
import PageHeaderWrapper from '../../components/PageHeaderWrapper';
import styles from './index.module.less';
import ReactPdfDemo1 from './ReactPdfDemo1';
import ReactPdfRenderer from './ReactPdfRenderer';

// pdfjs.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

interface HomeProps {
  path: string;
}

const Home = (props: HomeProps) => {
  const history = useHistory();

  return (
    <PageHeaderWrapper path={props.path}>
      <div className={styles.content_box}>
        <Button
          type="primary"
          onClick={() => {
            console.log(props);
            history.push('/app/demo');
          }}
        >
          跳转demo页面
        </Button>

        <ReactPdfRenderer />
      </div>
    </PageHeaderWrapper>
  );
};

export default Home;
